﻿@model Adams.Web.Areas.MyAdams.Models.Businesses.Index.PageLoad
@{
    Layout = "~/Views/Shared/_MembershipLayout.Mobile.cshtml";
}
@section Head{
    <link rel="stylesheet" type="text/css" href="/Areas/MyAdams/Content/Businesses/index.css" />
}
<h1>My Businesses</h1>

<a class="shortcut-button" href="/MyAdams/Businesses/Create"><span>
    Add a new Business</span></a>
@foreach (var Business in Model.Businesses)
{
    var did = "p_" + Business.ID.ToString();
    <div id="@did" class="posting">
        <div class="align-right">
            <input class="button edit" type="button" value="Edit" pid="@Business.ID" />
            @if (Adams.Shared.DateHelper.DiffDays(DateTime.Now, Business.ExpiresOn) < 0)
            {
                <input class="bluebutton renew" type="button" value="Renew" pid="@Business.ID" />    
            }
            <input class="redbutton remove" type="button" value="Remove" pid="@Business.ID" />
        </div>
        @if (Adams.Shared.DateHelper.DiffDays(DateTime.Now, Business.ExpiresOn) < 0)
        {
            <text>Expired</text>
        }
        else
        {
            if (Business.Status == Adams.Shared.Entities.Businesses.Status.PendingApproval)
            {
                <text>Waiting for Approval</text>
            }
            else if (Business.Status == Adams.Shared.Entities.Businesses.Status.Approved)
            {
                <text>Approved</text>
            }
            else if (Business.Status == Adams.Shared.Entities.Businesses.Status.Rejected)
            {
                <text>Rejected</text>
            }
            else if (Business.Status == Adams.Shared.Entities.Businesses.Status.Expired)
            {
                <text>Expired</text>
            }
        }
        <br />Name: @Business.Name
        <br />Created On: @Business.CreatedOn.ToShortDateString()
        <br />Expires On:
        <span class="exp">@Business.ExpiresOn.ToShortDateString()</span>
        <br />Address: @Business.Street
        <br />@Business.Street2
        <br />@Business.City, @Business.State @Business.Zip
        <br />@Business.Phone
        <br />Description: 
        <br />@Business.Description
    </div>
}
@section Scripts {
    <script src="/Areas/MyAdams/Scripts/Businesses/index.js" type="text/javascript"></script>
}